home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kstdgameaction.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  8.2 KB  |  262 lines

  1. /*
  2.     This file is part of the KDE games library
  3.     Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de)
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License version 2 as published by the Free Software Foundation.
  8.  
  9.     This library is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.     Library General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU Library General Public License
  15.     along with this library; see the file COPYING.LIB.  If not, write to
  16.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17.     Boston, MA 02110-1301, USA.
  18. */
  19. // this class was shamelessy stolen from kdelibs/kdeui/kstdction.[cpp|h] and
  20. // after that just edited for our needs
  21. #ifndef KSTDGAMEACTION_H
  22. #define KSTDGAMEACTION_H
  23.  
  24. class KAction;
  25. class KToggleAction;
  26. class QObject;
  27. class KActionCollection;
  28. class KRecentFilesAction;
  29. class KSelectAction;
  30. #include <kdemacros.h>
  31.  
  32. //-----------------------------------------------------------------------------
  33. /**
  34.  * Replacement for KStdAction for KDE Games
  35.  *
  36.  * This class is an extension to the usual KStdAction class which provides
  37.  * easy access to often used KDE actions
  38.  *
  39.  * Games often use different menu entries than other programs, e.g. games use
  40.  * the menu "game" instead of "file". This class provides the entries which
  41.  * differ from the usual KStdAction entries.
  42.  *
  43.  * @see KStdAction
  44.  *
  45.  * @author Andreas Beckermann <b_mann@gmx.de>
  46.  */
  47. // #### KDE4: transform in namespace
  48. class KDE_EXPORT KStdGameAction
  49. {
  50. public:
  51.   /**
  52.    * The standard menubar and toolbar actions.
  53.    **/
  54.     enum StdGameAction {
  55.         // Game menu
  56.         New=1, Load, LoadRecent, Save, SaveAs, End, Pause, Highscores,
  57.         Print, Quit,
  58.         // Move menu
  59.         Repeat, Undo, Redo, Roll, EndTurn,
  60.         // Settings menu
  61.         Carddecks,
  62.         ChooseGameType, // @since 3.2
  63.         ConfigureHighscores, // @since 3.2
  64.  
  65.         Restart, // @since 3.2
  66.         Hint, // @since 3.2
  67.         Demo, // @since 3.2
  68.         Solve, // @since 3.2
  69.         ActionNone // @since 3.2
  70.     };
  71.  
  72.     KStdGameAction();
  73.     ~KStdGameAction();
  74.  
  75.     /**
  76.      * Creates an action corresponding to the
  77.      * KStdAction::StdAction enum.
  78.      * @since 3.2
  79.      */
  80.     static KAction* create( StdGameAction id, const char *name,
  81.                 const QObject *recvr, const char *slot,
  82.                 KActionCollection* parent );
  83.  
  84.     /**
  85.      * @since 3.2
  86.      */
  87.     static KAction* create( StdGameAction id,
  88.         const QObject *recvr, const char *slot,
  89.         KActionCollection* parent )
  90.         { return create( id, 0, recvr, slot, parent ); }
  91.  
  92.  
  93.     /**
  94.      * Retrieve the action corresponding to the
  95.      * KStdGameAction::StdGameAction enum.
  96.      * @deprecated
  97.      */
  98.     static KAction *action(StdGameAction act_enum, const QObject *recvr = 0,
  99.                            const char *slot = 0, KActionCollection *parent = 0,
  100.                            const char *name = 0L );
  101.  
  102.     /**
  103.      * This will return the internal name of a given standard action.
  104.      * @since 3.2
  105.      */
  106.     static const char* name( StdGameAction id );
  107.  
  108.     /**
  109.      * This will return the internal name of a given standard action.
  110.      * @deprecated
  111.      */
  112.     static const char* stdName(StdGameAction act_enum);
  113.  
  114.     /**
  115.      * Start a new game
  116.      **/
  117.     static KAction *gameNew(const QObject *recvr = 0, const char *slot = 0,
  118.                             KActionCollection *parent = 0, const char *name = 0L );
  119.  
  120.     /**
  121.      * Load a previousely saved game
  122.      */
  123.     static KAction *load(const QObject *recvr = 0, const char *slot = 0,
  124.                          KActionCollection *parent = 0, const char *name = 0L );
  125.  
  126.     /**
  127.      * Load a recently loaded game.
  128.      */
  129.     static KRecentFilesAction *loadRecent(const QObject *recvr = 0, const char *slot = 0,
  130.                          KActionCollection *parent = 0, const char *name = 0L );
  131.  
  132.     /**
  133.      * Save the current game.
  134.      */
  135.     static KAction *save(const QObject *recvr = 0, const char *slot = 0,
  136.                          KActionCollection *parent = 0, const char *name = 0L );
  137.  
  138.     /**
  139.      * Save the current game under a different filename.
  140.      */
  141.     static KAction *saveAs(const QObject *recvr = 0, const char *slot = 0,
  142.                            KActionCollection *parent = 0, const char *name = 0L );
  143.  
  144.     /**
  145.      * Pause the game
  146.      **/
  147.     static KToggleAction *pause(const QObject *recvr = 0, const char *slot = 0,
  148.                            KActionCollection *parent = 0, const char *name = 0L );
  149.  
  150.     /**
  151.      * Show the highscores.
  152.      */
  153.     static KAction *highscores(const QObject *recvr = 0, const char *slot = 0,
  154.                            KActionCollection *parent = 0, const char *name = 0L );
  155.  
  156.  
  157.     /**
  158.      * End the current game, but do not quit the program. Think of a "close"
  159.      * entry.
  160.      */
  161.     static KAction *end(const QObject *recvr = 0, const char *slot = 0,
  162.                           KActionCollection *parent = 0, const char *name = 0L );
  163.  
  164.     /**
  165.      * Print the current screen? Game? Whatever - hardly used in games but there
  166.      * is at least one example (ktuberling)
  167.      */
  168.     static KAction *print(const QObject *recvr = 0, const char *slot = 0,
  169.                           KActionCollection *parent = 0, const char *name = 0L );
  170.  
  171.     /**
  172.      * Quit the game.
  173.      */
  174.     static KAction *quit(const QObject *recvr = 0, const char *slot = 0,
  175.                          KActionCollection *parent = 0, const char *name = 0L );
  176.  
  177.  
  178.  
  179.     /**
  180.      * Repeat the last move.
  181.      **/
  182.     static KAction *repeat(const QObject *recvr = 0, const char *slot = 0,
  183.                          KActionCollection *parent = 0, const char *name = 0L );
  184.  
  185.     /**
  186.      * Undo the last move
  187.      **/
  188.     static KAction *undo(const QObject *recvr = 0, const char *slot = 0,
  189.                          KActionCollection *parent = 0, const char *name = 0L );
  190.  
  191.     /**
  192.      * Redo the last move (which has been undone)
  193.      **/
  194.     static KAction *redo(const QObject *recvr = 0, const char *slot = 0,
  195.                          KActionCollection *parent = 0, const char *name = 0L );
  196.  
  197.     /**
  198.      * Roll die or dice
  199.      **/
  200.     static KAction *roll(const QObject *recvr = 0, const char *slot = 0,
  201.                          KActionCollection *parent = 0, const char *name = 0L );
  202.  
  203.     /**
  204.      * End the current turn (not the game). Usually to let the next player
  205.      * start
  206.      **/
  207.     static KAction *endTurn(const QObject *recvr = 0, const char *slot = 0,
  208.                          KActionCollection *parent = 0, const char *name = 0L );
  209.  
  210.  
  211.     /**
  212.      * Display configure carddecks dialog.
  213.      */
  214.     static KAction *carddecks(const QObject *recvr = 0, const char *slot = 0,
  215.                                 KActionCollection *parent = 0, const char *name = 0L );
  216.  
  217.     /**
  218.      * Display configure highscores dialog.
  219.      * @since 3.2
  220.      */
  221.     static KAction *configureHighscores(const QObject *recvr = 0, const char *slot = 0,
  222.                                 KActionCollection *parent = 0, const char *name = 0L );
  223.  
  224.     /**
  225.      * Give an advice/hint.
  226.      * @since 3.2
  227.      */
  228.     static KAction *hint(const QObject *recvr = 0, const char *slot = 0,
  229.                          KActionCollection *parent = 0, const char *name = 0L );
  230.  
  231.     /**
  232.      * Show a demo.
  233.      * @since 3.2
  234.      */
  235.     static KToggleAction *demo(const QObject *recvr = 0, const char *slot = 0,
  236.                                KActionCollection *parent = 0, const char *name = 0L );
  237.  
  238.     /**
  239.      * Solve the game.
  240.      * @since 3.2
  241.      */
  242.     static KAction *solve(const QObject *recvr = 0, const char *slot = 0,
  243.                           KActionCollection *parent = 0, const char *name = 0L );
  244.  
  245.     /**
  246.      * Choose game type.
  247.      * @since 3.2
  248.      */
  249.     static KSelectAction *chooseGameType(const QObject *recvr = 0, const char *slot = 0,
  250.                                          KActionCollection *parent = 0, const char *name = 0L );
  251.  
  252.     /**
  253.      * Restart game.
  254.      * @since 3.2
  255.      */
  256.     static KAction *restart(const QObject *recvr = 0, const char *slot = 0,
  257.                             KActionCollection *parent = 0, const char *name = 0L );
  258.  
  259. };
  260.  
  261. #endif
  262.